package org.brisling.common.crypt.strategy.base;

import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;

import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;

/**
 * 
 * <p>Title: AbstractCrypt</p>
 * <p>Description: 策略模式加密解密抽象类</p>
 * <p>Company: tongking</p>
 * @author jackson wang
 * @since 1.0
 * @version 1.0
 * @date 2017年5月18日 上午11:33:10
 */
public abstract class AbstractCrypt {

	//密钥
	protected Key  key = null;
	
	protected String type = "AES";
	//模式
	protected Integer mode = Cipher.ENCRYPT_MODE;
	
	protected Cipher cipher = null;
	
	public AbstractCrypt(String type){
		
		
		this.type = type;
		try {
			cipher = Cipher.getInstance(this.type);
		} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}	
	
}
